//
//  NowAnnouncedCell.m
//  YunGou
//
//  Created by macbook on 16/5/19.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "NowAnnouncedCell.h"
#import "MZTimerLabel.h"
#import <UIImageView+WebCache.h>

@interface NowAnnouncedCell ()<MZTimerLabelDelegate>
@property (weak, nonatomic) IBOutlet MZTimerLabel *countdownLabel;
@property (weak, nonatomic) IBOutlet UIImageView *thumbImg;
@property (weak, nonatomic) IBOutlet UILabel *titLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@end

@implementation NowAnnouncedCell

- (void)awakeFromNib {
}

- (void)setAnnounceModel:(ProductModel *)announceModel{
    if (!_countdownLabel.counting) {
        [_countdownLabel start];
    }
    _countdownLabel.timerType = MZTimerLabelTypeTimer;
    _countdownLabel.delegate = self;
    [_countdownLabel setCountDownTime:announceModel.q_end_time - NowTime];
    _countdownLabel.timeFormat = @"mm:ss SS";
    [_countdownLabel start];
    [_thumbImg sd_setImageWithURL:[NSURL URLWithString:[ImageUrl stringByAppendingString:announceModel.thumb]]];
    _titLabel.text = announceModel.title;
    _priceLabel.text = [NSString stringWithFormat:@"价值：￥%@",announceModel.money];
}

-(void)timerLabel:(MZTimerLabel*)timerLabel finshedCountDownTimerWithTime:(NSTimeInterval)countTime{
    if (self.block) {
        self.block();
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
